package com.szq.netty.server;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioDatagramChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;

/**
 * @ClassName: MyChannelInitializer
 * @Description:
 * @Author: szq
 * @Date: 2021-11-10 16:40:13
 */
public class MyChannelInitializer extends ChannelInitializer<NioDatagramChannel> {

    private EventLoopGroup group = new NioEventLoopGroup();

    @Override
    protected void initChannel(NioDatagramChannel channel) {
        // 在管道中添加我们自己的接收数据实现方法
        channel.pipeline().addLast(group, new MyServerHandler());
    }
}
